Skip to content

[Subcontracting] Disable "WIP Item Transfer" for Machine Center - #8747

Open
Sebastian Pinkow GOB (SPinkow) wants to merge 7 commits into
microsoft:mainfrom
GOB-Software-Systeme-DevOps:w/pinkow/Issue36_EditabilityOfWIPItemFields
Open

[Subcontracting] Disable "WIP Item Transfer" for Machine Center#8747
Sebastian Pinkow GOB (SPinkow) wants to merge 7 commits into
microsoft:mainfrom
GOB-Software-Systeme-DevOps:w/pinkow/Issue36_EditabilityOfWIPItemFields

Conversation

@SPinkow

@SPinkow Sebastian Pinkow GOB (SPinkow) commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What & why

This pull request introduces stricter validation and improved UI logic for the "Transfer WIP Item" field on routing lines, ensuring that this field is only enabled and valid for "Work Center" type routing lines with subcontracting enabled. It also adds comprehensive automated UI and validation tests to guarantee correct behavior, and refactors some test utilities for better coverage and maintainability.

Validation and UI logic improvements:

  • The "Transfer WIP Item" field is now only enabled and valid for routing lines of type "Work Center" with subcontracting enabled; it is disabled and validation fails for "Machine Center" types. [1] [2] [3]
  • The "Transfer WIP Item" field is explicitly set as non-editable and invisible in the Subc. PO Subform page extension.

Automated test coverage:

  • Added multiple UI and validation tests in Subc. Subcontracting UI Test to verify that the "Transfer WIP Item" field is only enabled for eligible Work Center lines and not for Machine Center lines, and that validation fails if incorrectly set.

Test utility enhancements:

  • Introduced a new CreateRoutingLineForMachineCenter helper in the manufacturing management test library to streamline test setup for Machine Center routing lines, and made CreateRoutingLine public for broader utility. [1] [2]
  • Added necessary codeunit references and error labels to support the new test scenarios. [1] [2]

Linked work

Fixes AB#640173

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)
Added Tests and do a manual validation in client

Risk & compatibility

None

@SPinkow
Sebastian Pinkow GOB (SPinkow) requested a review from a team June 23, 2026 14:19
@github-actions github-actions Bot added needs-approval Workflow runs require maintainer approval to start AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork labels Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link.

@SPinkow Sebastian Pinkow GOB (SPinkow) changed the title Disable "WIP Item Transfer" for Machine Center [Subcontracting] Disable "WIP Item Transfer" for Machine Center Jun 23, 2026
@alexei-dobriansky
alexei-dobriansky enabled auto-merge (squash) June 23, 2026 14:29
@github-actions github-actions Bot added Linked Issue is linked to a Azure Boards work item and removed needs-approval Workflow runs require maintainer approval to start labels Jun 23, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 23, 2026
@ChethanT Chethan Thopaiah (ChethanT) added the Subcontracting Subcontracting related activities label Jun 23, 2026
@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) added the SCM GitHub request for SCM area label Jun 30, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 1

Recommendation: Request Changes

What this PR does

This PR blocks Transfer WIP Item on setup routing lines when the line type is Machine Center. It also disables the field on the Routing Lines and Routing Version Lines pages, hides the field on the purchase order subform, and adds UI and table validation tests.

The change is correct for the setup Routing Line table path. However, the same field also exists on Prod. Order Routing Line, and that table and page still use only Subcontracting to allow the field. Because the actual subcontracting WIP transfer flow reads the production order routing line, the invalid Machine Center setting remains reachable after a routing becomes a production order routing.

Suggestions

S1 - Production routing still allows Machine Center
Prod. Order Routing Line still validates Transfer WIP Item only against Subcontracting, and Subc. Prod. Order Rtng. still enables the page field only from Rec.Subcontracting. Add the same Type = Work Center guard there, and add a regression test for a Machine Center production order routing line. Otherwise the invalid setting is still possible in the actual subcontracting order flow.

Risk assessment and necessity

Risk: The affected area is subcontracting manufacturing setup and WIP transfer. The setup routing line change is narrow and has tests, but leaving the production order routing path open can still allow invalid WIP transfer data in the real order flow. No public API signatures or BaseApp event contracts are changed.

Necessity: The linked Bug is valid and important: Transfer WIP Item is only meaningful for subcontracting Work Center lines. The fix is necessary, but the current scope is too small because the analogous production order routing path still permits the same invalid configuration.


[AI-PR-REVIEW] version=1 system=github pr=8747 round=1 by=alexei-dobriansky at=2026-07-02T09:51:32Z lastSha=228315dd81224f2ccd282782a52ba30b44f6075c suggestions=S1

@alexei-dobriansky alexei-dobriansky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider the suggestions

auto-merge was automatically disabled July 2, 2026 14:46

Head branch was pushed to by a user without write access

@SPinkow

Copy link
Copy Markdown
Contributor Author

Please consider the suggestions

Done

@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Jul 2, 2026
@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Jul 2, 2026
@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Breaking\ Changes}$

This PR hardens Transfer WIP Item from a previously accepted Machine Center scenario into a Type = Work Center runtime requirement: Routing Line and Prod. Order Routing Line now throw on Validate("Transfer WIP Item", true), and the related pages disable the field for Machine Center lines. That is an externally observable behavior break for any extension, automation, or existing workflow that set the flag on Machine Center subcontracting lines. If the combination must be retired, add an upgrade path that clears or migrates existing non-Work-Center values and preserve backward compatibility instead of introducing an immediate validation failure.

Agent judgement — not directly backed by a BCQuality knowledge article.

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.26.4

@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Jul 31, 2026
@SPinkow

Copy link
Copy Markdown
Contributor Author

🟡 Medium Severity — Breaking Changes

This PR hardens Transfer WIP Item from a previously accepted Machine Center scenario into a Type = Work Center runtime requirement: Routing Line and Prod. Order Routing Line now throw on Validate("Transfer WIP Item", true), and the related pages disable the field for Machine Center lines. That is an externally observable behavior break for any extension, automation, or existing workflow that set the flag on Machine Center subcontracting lines. If the combination must be retired, add an upgrade path that clears or migrates existing non-Work-Center values and preserve backward compatibility instead of introducing an immediate validation failure.

Agent judgement — not directly backed by a BCQuality knowledge article.

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.26.4

In this special case it should not be a breaking change, because an parallel PR was created for 28.x branch before the first release of the subcontracting app:
#8748
This PR was merged before creating 28.3 branch where subcontracting app has been shipped for the first time . o no new functionality is added.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Aug 13, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 1

Recommendation: Request Changes

What this PR does

This PR disables the Transfer WIP Item control for Machine Center routing lines and adds validation so the flag can only be set on Work Center lines. That is the right direction, and the new UI and validation tests cover the direct edit path. The fix is still incomplete because production order routing lines can receive the flag from routing lines through copy/refresh logic without running the new validation.

Suggestions

S1 - Machine-center WIP flags still copy forward
Existing Routing Line records can already have Transfer WIP Item = true on Machine Center lines. OnAfterCopyFromRoutingLine still copies that value to production order routing lines without validation, so a refreshed production order can still create WIP transfer orders for a Machine Center. Clear or ignore the flag when the line type is not Work Center in the copy/refresh path.

Risk assessment and necessity

Risk: This area drives WIP transfer order creation and warehouse flow. If an old Machine Center routing line keeps the flag, the system can still create inventory movement for a scenario this PR is meant to block.

Necessity: The change is needed because Machine Centers should not use Transfer WIP Item. The scope must also cover copied or existing data, not only new page edits.

[AI-PR-REVIEW] version=1 promptVersion=2 system=github pr=8747 round=1 by=alexei-dobriansky at=2026-08-13T11:31:02Z lastSha=949ba428a884f93bc025249943171e5d252e5232 reviewKey=b4ea5e77a1f19c9f9ebcc2f06cd3a4e78b540abfc3ab1ea993d5434b2d554b54 suggestions=S1@0cc39440

@SPinkow

Copy link
Copy Markdown
Contributor Author

Agentic PR Review - Round 1

Recommendation: Request Changes

What this PR does
This PR disables the Transfer WIP Item control for Machine Center routing lines and adds validation so the flag can only be set on Work Center lines. That is the right direction, and the new UI and validation tests cover the direct edit path. The fix is still incomplete because production order routing lines can receive the flag from routing lines through copy/refresh logic without running the new validation.

Suggestions
S1 - Machine-center WIP flags still copy forward Existing Routing Line records can already have Transfer WIP Item = true on Machine Center lines. OnAfterCopyFromRoutingLine still copies that value to production order routing lines without validation, so a refreshed production order can still create WIP transfer orders for a Machine Center. Clear or ignore the flag when the line type is not Work Center in the copy/refresh path.

Risk assessment and necessity
Risk: This area drives WIP transfer order creation and warehouse flow. If an old Machine Center routing line keeps the flag, the system can still create inventory movement for a scenario this PR is meant to block.

Necessity: The change is needed because Machine Centers should not use Transfer WIP Item. The scope must also cover copied or existing data, not only new page edits.

[AI-PR-REVIEW] version=1 promptVersion=2 system=github pr=8747 round=1 by=alexei-dobriansky at=2026-08-13T11:31:02Z lastSha=949ba428a884f93bc025249943171e5d252e5232 reviewKey=b4ea5e77a1f19c9f9ebcc2f06cd3a4e78b540abfc3ab1ea993d5434b2d554b54 suggestions=S1@0cc39440

As mentioned earlier no upgrade should be needed.

@attilatoury

Copy link
Copy Markdown
Contributor

This PR seems to have more changes now than its 28.x counterpart #8748 so if we also want them on 28.x, let's not forget the second half of the backport

@attilatoury

Copy link
Copy Markdown
Contributor

High — The Italian migration creates the state this PR prohibits

The legacy [RoutingLine.Table.al:396-407] has no Type validation. Therefore legacy Machine Center lines can legitimately reach migration with WIP Item = true.

The migration then:

  • Filters only on WIP Item = true for both record types in [ITSubcMigration.Codeunit.al:552-563].
  • Copies the value through direct assignment rather than Validate() in [ITSubcMigration.Codeunit.al:266-309].

That bypasses the new invariant. The resulting Machine Center flag becomes disabled in the UI, while [SubcProdOrderRtngExt.Codeunit.al:197-207]
unconditionally propagates it into production routing, where transfer creation consumes it.

Required:

  • Migrate the flag only when the complete new invariant is satisfied, or explicitly clear it otherwise.
  • Defensively prevent OnAfterCopyFromRoutingLine from copying it for non-Work-Center lines.
  • Add migration and copy-path tests seeded with a Machine Center legacy flag. The PR’s current tests cover only fresh Validate(..., true) calls.

@SPinkow

Copy link
Copy Markdown
Contributor Author

High — The Italian migration creates the state this PR prohibits

The legacy [RoutingLine.Table.al:396-407] has no Type validation. Therefore legacy Machine Center lines can legitimately reach migration with WIP Item = true.

The migration then:

  • Filters only on WIP Item = true for both record types in [ITSubcMigration.Codeunit.al:552-563].
  • Copies the value through direct assignment rather than Validate() in [ITSubcMigration.Codeunit.al:266-309].

That bypasses the new invariant. The resulting Machine Center flag becomes disabled in the UI, while [SubcProdOrderRtngExt.Codeunit.al:197-207] unconditionally propagates it into production routing, where transfer creation consumes it.

Required:

  • Migrate the flag only when the complete new invariant is satisfied, or explicitly clear it otherwise.
  • Defensively prevent OnAfterCopyFromRoutingLine from copying it for non-Work-Center lines.
  • Add migration and copy-path tests seeded with a Machine Center legacy flag. The PR’s current tests cover only fresh Validate(..., true) calls.

As mentioned earlier no upgrade should be needed becaus ethis part of code shopuld be already in BC28.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item SCM GitHub request for SCM area Subcontracting Subcontracting related activities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants